package controllers

import ("github.com/revel/revel"
	"net/http"
)

type App struct {
	*revel.Controller
}

func (c App) Index() revel.Result {

	revel.TRACE.Printf("%s", revel.AppName+ ":  开始测试")
	revel.ERROR.Printf("%s", revel.AppName+ ":  开始测试")
	dbUrl := revel.Config.StringDefault("db.url", "notfound")
	kaibb := revel.Config.HasSection("kaibb")
	revel.Config.SetSection("kaibb");
	zh_CN := &http.Cookie{
		Name:     revel.Config.StringDefault("i18n.cookie", revel.CookiePrefix+"_LANG"),
		Value:   "zh",
		Path:     "/",
		HttpOnly: revel.CookieHttpOnly,
		Secure:   revel.CookieSecure,

	}
	c.SetCookie(zh_CN)
	c.RenderArgs["dbUrl"] = dbUrl
	c.RenderArgs["kaibb"] = kaibb
	c.RenderArgs["appHello"] = revel.Config.StringDefault("app.hello", "世界啊")
	c.RenderArgs["dbPort"] = revel.Config.StringDefault("db.port", "defaultPort")
	c.RenderArgs["title"] = c.Message("title")
	return c.Render()
}
